/*
* EP-Tracing System : a tool to trace mountain hike.           .kNNx
* Copyright (C) 2009  Raffaello Brondi                         'KNNNk
*                                                             ,XNNNl
* This program is free software:                             ,XNN0'
* you can redistribute it and/or modify                     ,XNNx.
* it under the terms of the                                'XNNl
* GNU General Public License                              .KNN:                     ..
* as published by                                        .0NNo                    .ONNO.
* the Free Software Foundation,                          xNNN.  :dkd,            .KNNNN;
* either version 3 of the License, or                   :NNNK ;XNNNNNo          ,KNNNX:
* (at your option) any later version.                   xNNNNcXNNNNNNk         cNNNNx.
*                                                       ,XNNNNNNNNNNX'       .xNNNK;
*                                                        .lKNNNNNNNK'       :KNNNo
*                                                          ;kNNNNNKxl;'.'l0NNNk.
* This program is distributed in                          .'  .:xXNNNNNNNNNNNO,
* the hope that it will be useful,                       :NNXd'   ,oONNNNNNk,
* but WITHOUT ANY WARRANTY;                              xNNNNN0c.    .;;,.
* without even the implied warranty of                   kNNNNNNNXd'
* MERCHANTABILITY or                                     xNNNNNNNNNNOc.
* FITNESS FOR A PARTICULAR PURPOSE.                      xNNNNNNNNNNNNXd.
* See the GNU General Public License                     ONNNN0.,o0NNNNNNl
* for more details.                                      0NNNNd    kNNNNNX.
*                                                        KNNNNl   oNNNNNXc
*                                                       .XNNNN:  dNNNNNx.
* You should have received a copy                       .XNNNN; lNNNNO'
* of the GNU General Public License                     .XNNNN; 'dxo'
* along with this program.                              .XNNNN;
* If not, see <http://www.gnu.org/licenses/>.            0NNNN:
*                                                        kNNNNc
*                                                        oNNNNd
*                                                        ;NNNN0
* Contact: rbrondi@gmail.com                             .XNNNN;
*                                                         kNNNNd
*                                                         .coo:.
*/

package EP.UI.Compass;

import EP.EPHReader;
import EP.Utils;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;

/**
 *
 * @author Raffaello Brondi
 */
public class EPHDetailsViewer extends Form {
    private static final String TEXT_NAME = "Name of the hike: ";
    private static final String TEXT_DISTANCE = "Hike distance(in km): ";
    private static final String TEXT_ALTITUDE = "Altitude available: ";
    private static final String TEXT_TIME = "Total time: ";

    private EPHReader reader;

    public EPHDetailsViewer(String file, CommandListener listener){
        super("Hike deteils");

        this.reader = EPHReader.getInstance(file);

        StringItem name = new StringItem(TEXT_NAME, reader.get(Utils.HIKE_NAME));
        StringItem distance = new StringItem(TEXT_DISTANCE, reader.get(Utils.HIKE_TOTAL_DISTANCE));
        StringItem altitude = new StringItem(TEXT_ALTITUDE, reader.get(Utils.HIKE_ALTITUDE));
        StringItem time = new StringItem(TEXT_TIME, reader.get(Utils.HIKE_TOTAL_TIME));

        this.append(name);
        this.append(distance);
        this.append(altitude);
        this.append(time);

        Command back = new Command("Back", Command.BACK, 0);
        this.addCommand(back);
        this.setCommandListener(listener);
    }

}
